﻿using System;
using System.Xml.Linq;

namespace Holidays.CountryCalculators {

	public class GermanCalculator : BaseCalculator {

		public override Boolean IsWeekend(DateTime date) {
			return date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday;
		}

		protected override Boolean IsDynamicHoliday(DateTime date, XDocument holidayData) {
			DateTime easter = date.Easter(EasterAlgorithm.Gauss);
			// TODO: Dynamic, based on de-DE.xml!??!
			return (
					// Karfreitag
					easter.AddDays(-2).Date == date.Date ||
					// Ostermontag
					easter.AddDays(1).Date == date.Date ||
					// Oster
					easter.Date == date.Date ||
					// Christi Himmelfahrt
					easter.AddDays(39).Date == date.Date ||
					// Pfingstmontag
					easter.AddDays(50).Date == date.Date ||
					// 	Fronleichnam
					easter.AddDays(60).Date == date.Date
				);
		}
	}
}